package com.lovo.lesson;

import javax.swing.*;
import java.awt.*;
import java.net.URL;

public class Test09 extends JFrame {
    private Image bgImg = new ImageIcon(Test09.class.getResource("/images/mybg.jpg")).getImage();
    public Test09(){
        this.setContentPane(new JPanel(){
            @Override
            protected void paintComponent(Graphics g) {
                super.paintComponent(g);
                g.drawImage(bgImg,0,0,800,600,this);
            }
        });
        this.setLayout(null);
//        System.out.println();
        this.setIconImage(new ImageIcon(Test09.class.getResource("/images/vscode.png")).getImage());


        JButton btn = new JButton("OK");
        btn.setBounds(0,0,100,20);
        this.add(btn);

        JTextField textField = new JTextField();
        textField.setBounds(0,30,200,20);
        this.add(textField);
        this.setTitle("hello");
        this.setSize(800,600);
        this.setLocationRelativeTo(null);
        this.setDefaultCloseOperation(EXIT_ON_CLOSE);
        this.setVisible(true);
    }

    public static void main(String[] args) {
        new Test09();
    }
}
